home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / misc~1 / 5 / osspascl / osspas.rev < prev    next >
Text File  |  1985-11-19  |  18KB  |  417 lines

  1.  
  2.                                 PERSONAL PASCAL
  3.                                  (OSS $79.95)
  4.                              Reviewed by Ed Seward
  5.  
  6.  
  7.  Let me start with the disk and it's contents.  Among the files on the disk
  8.  are the required four program files: PASCAL.PRG, EDIT.PRG, COMPILER.PRG and
  9.  LINKER.PRG. (More on these files in a little bit.)  Also on the disk is a
  10.  collection of demo programs, a list of errors found in so far and several
  11.  "Include" files for accessing GEM.
  12.  
  13.  The execution of PASCAL.PRG (the "Manager") places you in the Pascal
  14.  environment.  From this point you can choose the compiler and linker options
  15.  and save them as the new defaults.  There are three things I don't like at
  16.  this level.  The first is that when exiting the Pascal manager after
  17.  compiling; it takes a few tries with the mouse to get window slide bars to
  18.  work properly.  Another is the editor and compiler can only use filenames
  19.  with the extension of "PAS".  This means one has to change the name of the
  20.  file from the GEM Desktop.  (One can display the whole directory from the
  21.  Pascal manager, its just when a file with an extension other than "PAS" is
  22.  used that kicks one back to the manager).  The last thing is that on a one
  23.  drive system all the required files must be on the same disk.  This problem
  24.  could be taken care of in a one meg machine with a ramdisk.
  25.  
  26.  The Pascal Editor.  Upon entering the editor one will notice a status line at
  27.  the top of the screen.  On the left end of the line is the name of the file
  28.  being edited including the drive and path.  The right side of the line is for
  29.  the various indicators like: whether one is in "insert" or "replace" mode; if
  30.  the auto backup is enabled; auto indent on/off.  There is also a counter for
  31.  the amount of memory available for the source code and the line number of the
  32.  cursor's position.
  33.  
  34.  The writers of Personal Pascal have set up the editor so as to make as many
  35.  people happy as possible.  For most commands, one has a choice of using
  36.  "Wordstar" commands or using the cursor control keys.  The availabilty of the
  37.  "Wordstar" commands should make many people happy.  Personnaly, I prefer to
  38.  use the cursor keys.  To move one character in any of the four basic
  39.  directions, just use the appropriate arrow key.  To move up or down one
  40.  screen push a [Shift] key and an arrow key at the same time.  The [Shift]
  41.  left and right arrow keys allow one to go to the beginning or end of a line.
  42.  When using the [Control] key with the left and right arrow keys, the cursor
  43.  is moved to the beginning of the next word in the appropriate direction.
  44.  
  45.  Besides the additional keyboard editor commands there are the commands using
  46.  the function keys.  To delete a line and place in the copy buffer just press
  47.  the [F1] key.  Pressing the [Shift] and [F1] just deletes the line.  To
  48.  insert the copy buffer at the cursor's position press [F2].  The "Find" a
  49.  string command is [F3].  The search and replace string is [F4].  The [F5] key
  50.  causes the last find or search command to be repeated.  The auto indent is
  51.  toggled on/off with [F6].  The [Shift] and [F6] toggles the "BAK" or auto
  52.  backup state.  Using [F7] allows one to save either the copy buffer or the
  53.  complete text.  One can read a file into the copy buffer using [F8].  The
  54.  [F9] key saves the text back to the filename from which it was loaded.  (If
  55.  the backup is on then the original file's extension is changed to "BAK"
  56.  before writing the text to disk.)
  57.  
  58.  After writing the file and exiting the editor, the compiler is loaded and
  59.  executed.  (If there are no compiler errors and the option is set, the
  60.  compiler will chain to the linker.  Thus, with the push of a single key one
  61.  can have an executable program.)
  62.  
  63.  The Compiler.  There are eight options available from the Pascal Manager.
  64.  One is the choice to compile for GEM or TOS.  The "Pause after error" option
  65.  tells the compiler to pause or not after an error.  If one does not pause
  66.  after errors then all errors are written to a text file.  If one selects to
  67.  pause after error then when an error is found two windows will appear; one
  68.  with the line of source code where the error was found, an error number and a
  69.  text description of that error (if ERRORS.TXT is on the disk) and another
  70.  window asking "Ignore   Edit   Abort".  Ignore continues the compile; abort
  71.  returns one to the Pascal manager.  Edit exits the compiler, loads the editor
  72.  and the source file, puts the cursor at the position where the error was
  73.  found and displays the error message in the status line.  The "Chain to
  74.  linker" compiler option was mentioned earlier.  The "Temporary directory"
  75.  option allows one to specify a different directory/drive for the temporary
  76.  work files.  This option will be more useful after installing the TOS ROMs,
  77.  upgrading to one meg or when using a hard disk.
  78.  
  79.  There are three other options that are mainly for debugging.  "Full debug
  80.  mode" includes code such that the line number and the name of the procedure
  81.  where an error occurred will be displayed.  "Stack checking" and "Range
  82.  checking" are self explanatory.  If one tends to be a little lax in error
  83.  trapping then the last two options may save some potential system hangs.  The
  84.  last option is to include code to clear all the local variables.  I prefer to
  85.  handle that myself.
  86.  
  87.  I ran into one problem with the compiler.  I made an error in an include
  88.  directive that resulted in about twenty-five errors.  Not using the "Pause
  89.  after error", as near as I can tell, the compiler ran out of room on the
  90.  disk.  (The system was not hung in the true sense as it knew when a disk was
  91.  inserted into the drive and would run the motor.)  There was no error message
  92.  -- just nothing at all.  True, I could have made sure there was more than a
  93.  few k-bytes of space left on the disk.  There should have been some kind of
  94.  message and a way to get out of it without rebooting the system.
  95.  
  96.  While the compiler is running it displays the error count, each include
  97.  file's name as they are included and a cancel button to abort the compile.
  98.  The only thing I'll mention about the linker is that one has the option to
  99.  link for TOS or GEM.
  100.  
  101.  Personal Pascal.  So far I haven't found any of the ususal Pascal features
  102.  missing.  Several ones have been added.  String and byte were to be expected
  103.  and are supported.  Also included is Long_Integer.  The limit for integer
  104.  types (Maxint) is 32767 and Long_Maxint is 2,147,483,647 for long_integer
  105.  types.  Two functions "Shl" and "Shr" have been added to work with integer
  106.  types as shift-left and shift-right.  The usual string handling routines are
  107.  included; Concat, Copy, Length, Delete, Insert.  Random disk access is also
  108.  supported with a Seek procedure.  There are also a couple routines to access
  109.  the TOS command line; Cmd_Args returns the number of arguments in the command
  110.  line, Cmd_GetArg gets a command from the command line.  The list of
  111.  predefined portions of Personal Pascal below are from the manual.
  112.  
  113.  
  114.  =======================================================
  115.  Predefined Data Types
  116.  Alfa          Byte           Boolean        Char
  117.  Integer       Long_Integer   Real           String
  118.  Text
  119.  
  120.  Predefined Constants
  121.  False        Input         Long_Maxint     Maxint
  122.  Nil          Output        True
  123.  
  124.  Predefined Procedures
  125.  BasePage     Chain         Cmd_GetArg      Delete
  126.  Dispose      Erase         Get             Halt
  127.  Insert       Mark          Message         New
  128.  Pack         Page          Put             Read
  129.  Readln       Release       ReName          ReSet
  130.  ReWrite      UnPack        Write           Writeln
  131.  
  132.  Predefined Functions
  133.  Abs          ArcTan        Chr             Clock
  134.  Close        Cmd_Args      Concat          Copy
  135.  Cos          Eof           Eoln            Exp
  136.  Filename     Handle        KeyPress        Length
  137.  Ln           Long_Round    Long_Trunc      MemAvail
  138.  Odd          Option        Ord             Pos
  139.  Pred         PwrOfTen      Round           Shl
  140.  Shr          Sin           SizeOf          Sqr
  141.  Sqrt         Succ          Trunc
  142.  =======================================================
  143.  
  144.  There are 90 pages of documentation for the non-GEM portion of Pascal.
  145.  
  146.  Personal Pascal & GEM.  There are 98 routines for accessing GEM and 134 pages
  147.  of documentation for those routines.  There is routine for doing alert boxes
  148.  and it is plenty.  Most of the other routines can be grouped into four
  149.  catagories: dialog boxes, windows, the menu bar and event management.
  150.  
  151.  Two dialog boxes are very easy to implement.  One is to select an input file
  152.  and another is to select an output file.  Then there are numerous routines
  153.  used to set up a box including setting the type and color of text, buttons
  154.  and valid characters for an editable text field.  There are step-by-step
  155.  instructions for setting up a dialog box along with good explanations of the
  156.  routines.
  157.  
  158.  I haven't used the windows much -- yet.  I haven't used the rest of the
  159.  routines at all.  There are twenty-two window routines just for text styles
  160.  and graphics.  These include rectangle, oval and arc drawing, cursor move,
  161.  plot and line drawing.  The menu bar routines provide all that is needed for
  162.  one to do there own drop down menus.
  163.  
  164.  Documentation.  With one group of exceptions I would say the documentation
  165.  included with Personal Pascal is excellent and all one should expect.  The
  166.  group of exceptions are three directives: GEMDOS, BIOS and XBIOS.  They are
  167.  mentioned as existing and taking one integer parameter each.  (My
  168.  understanding is that the number of parameters should vary.)  As I write this
  169.  in early February, OSS has said they will be making the documentation
  170.  available in a few days.
  171.  
  172.  The rest of the manual I found to be very complete and easy to find the
  173.  information I needed.  This manual is not meant to teach Pascal and as such
  174.  it does not waste any space on a tutorial.
  175.  
  176.  Features (bugs).  I have come across two bugs besides the two I mentioned
  177.  earlier.  First, 'Read' and 'Write' only work on text files.  I played with
  178.  this for a while before using 'Get' and 'Put' as shown in the manual.  The
  179.  other problem is that the manual says 'Insert' can have a "packed array of
  180.  char" as the source to be inserted into a string.  I used other means to do
  181.  it one character at a time.
  182.  
  183.  I called OSS today to verify these bugs.  The guy I talked to said they are
  184.  getting ready to release a small patch to take care of the problem with the
  185.  slidebar when exiting Pascal.  The 'Insert' problem is probably a
  186.  documentation error.  OSS should be coming out with the next version of
  187.  Pascal in April.  There may be a patch to take care of the 'Read' and 'Write'
  188.  problem before then, if not, then that release should take care of the
  189.  problem.
  190.  
  191.  Performance.  Like any person with a new language for their computer, I was
  192.  anxious to run some benchmarks.  In the table on the next page are six
  193.  different time tests.  Two of the programs I converted from a review of
  194.  MODULA Compilers in the October 1985 issue of Computer Languages magazine
  195.  ("Microcomputer Modula-2 Analysis" by Namir Clement Shammas and Ken Magel).
  196.  [Modula-2 is basically an enhanced version of Pascal.]  Two others are fairly
  197.  standard but taken from a Turbo Pascal 3.0 review in the February 1986 issue
  198.  of Byte magazine ("Turbo Pascal 3.0" by Mark Bridger).  The magazines gave
  199.  times for these tests on the IBM PC (with and without an 8087) and one test
  200.  of MacModula-2 on the Macintosh.  I ran the same tests on the 520 ST using
  201.  OSS Personal Pascal and also, for comparison, using TDI's Modula-2.
  202.  
  203.  As you can see the times are pretty good.  The times for the Modula-2 package
  204.  on the ST are particularly good but note that the file sizes are much larger
  205.  than those developed using Personal Pascal.  I found the system easy to adapt
  206.  to and friendly to use.  There are quite a few error messages to make finding
  207.  the syntax errors a little easier.  I also liked the full debug mode as a
  208.  compiler option.  Even with the bugs I mentioned I think Personal Pascal is a
  209.  good way to take advantage of the ST's features.
  210.  
  211.  
  212.  
  213.  ==========================================================================
  214.         ------------R U N   T I M E S----------------
  215.           OSS   TDI    Turbo PASCAL Modula-2  MacMod  -----FILE SIZES------
  216.  Test   PASCAL MODULA ----V.3.0--- .COM  Mcode ula-2  OSS PASCAL TDI Mod-2
  217.  Program 520ST  520ST IBMPC w/8087 IBMPC IBMPC  Mac    Src Exec   Src Exec
  218.  ------- ----- -----  ----- ------ ----- ----- -----  ---- ----- ----  -----
  219.  SIEVE    7.5    6      13      --    8     123   80   794  4559  732  21682
  220.  CALC     7.2    3      32     6.5   --      --   --   333  6593  430  21648
  221.  FLOAT   20.5   20      65     3.0   --      --   --   339  8447  403  25372
  222.  SORT    <1.0   <1      --      --    2      15   30  1332  4892 1224  21964
  223.  MATRIX   3.5   2.5     --      --    1      20   13  1364 11461 1598  22574
  224.  ===========================================================================
  225.  
  226.  I am including the source code for the above benchmarks to make it easier for
  227.  standard tests on the new languages becoming available for the ST.
  228.  
  229.  
  230.  
  231.  Try these out on other computers or other languages on the ST and send the
  232.  results into CURRENT NOTES (122 N. Johnson Rd., Sterling, VA 22170).
  233.  
  234.  
  235.  
  236.  PROGRAM sieve(OUTPUT);
  237.  CONST size = 8190;
  238.  VAR count,i,iter,prime : INTEGER;
  239.      flags : ARRAY [0..size] OF BOOLEAN;
  240.  BEGIN
  241.    Writeln('START');
  242.    FOR iter := 1 TO 10 DO
  243.    BEGIN
  244.      count := 0;
  245.      FOR i := 0 TO size
  246.        DO flags[i] := TRUE;
  247.      FOR i := 0 TO size DO
  248.        IF flags[i] THEN
  249.        BEGIN
  250.          prime := i + i + 3;
  251.          k := i + prime;
  252.          WHILE k <= size DO
  253.          BEGIN
  254.            flags[k] := FALSE;
  255.            k := k + prime;
  256.          END;
  257.          count := count + 1;
  258.        END; { if then}
  259.      {end for i}
  260.    END; { for iter}
  261.    Write(count);
  262.    Writeln(' primes found');
  263.  END {program sieve}.
  264.  
  265.  
  266.  PROGRAM calc (OUTPUT);
  267.  {from February 1986 Byte magazine}
  268.  VAR a,b,c : REAL;
  269.      n,i,t : INTEGER;
  270.  BEGIN
  271.    Writeln('START');
  272.    FOR t := 1 TO 10 DO
  273.    BEGIN
  274.      n := 5000;
  275.      a := 2.21828;
  276.      b := 3.14159;
  277.      c := 1;
  278.      FOR i := 1 TO n DO
  279.      BEGIN
  280.        c := c * a;
  281.        c := c * b;
  282.        c := c / a;
  283.        c := c / b;
  284.      END;
  285.    END;
  286.    Writeln;
  287.    Writeln('Error = ',c-1);
  288.   END {program calc}.
  289.  
  290.  
  291.  PROGRAM float (OUTPUT);
  292.  {from February 1986 Byte mag.}
  293.  {I didn't add in other real functions}
  294.  {so as to keep 'float' standard.      }
  295.  VAR i : INTEGER;
  296.      x,y : REAL;
  297.  BEGIN
  298.    x := 1;
  299.    FOR i := 1 TO 1000 DO
  300.    BEGIN
  301.      y := Sin(x);
  302.      y := Ln(x);
  303.      y := Exp(x);
  304.      y := Sqrt(x);
  305.      y := Arctan(x);
  306.      x := x + 0.01;
  307.    END;
  308.  END {program float}.
  309.  
  310.  
  311.  PROGRAM CLMySort (OUTPUT);
  312.  {converted from Computer Language mag}
  313.  {MODULA listing in October 1985 issue}
  314.  {Program will test the speed of sor- }
  315.  {ting an integer array.  The program  }
  316.  {will create an array sorted from    }
  317.  {smaller to larger integers then sort}
  318.  
  319.  {them into reverse order.             }
  320.  CONST max = 1000;
  321.  TYPE  numbers = ARRAY [1..max] OF INTEGER;
  322.  VAR done : BOOLEAN;
  323.      jump,i,j,temp : INTEGER;
  324.      a : numbers;
  325.  BEGIN
  326.    Writeln('Initializing integer array');
  327.    FOR i := 1 TO max
  328.      DO a[i] := i;
  329.    jump := max;
  330.    Writeln('Beginning to work');
  331.    WHILE jump > 1 DO
  332.    BEGIN
  333.      jump := jump DIV 2;
  334.      REPEAT
  335.        done := TRUE;
  336.        FOR j := 1 TO (max - jump) DO
  337.        BEGIN
  338.          i := j + jump;
  339.          IF a[i] > a[j] THEN
  340.          BEGIN
  341.            done := FALSE;
  342.            temp := a[i];
  343.            a[i] := a[j];
  344.            a[j] := temp;
  345.          END { if then};
  346.        END { for do };
  347.      UNTIL done;
  348.    END {while};
  349.    Writeln('Finished sorting!');
  350.    FOR i := 1 TO max
  351.      DO Write(a[i],'   ');
  352.    Writeln;
  353.  END {program CLMySort}.
  354.  
  355.  
  356.  PROGRAM CLMatix(OUTPUT);
  357.  CONST n = 20;
  358.  TYPE row = ARRAY [1..n] OF REAL;
  359.       table = ARRAY[1..n] OF row;
  360.  VAR a,b,c : table;
  361.      sum : REAL;
  362.      i,j,k : INTEGER;
  363.      ch : CHAR;
  364.  
  365.  PROCEDURE FillA;
  366.  VAR i,j : INTEGER;
  367.  BEGIN
  368.    FOR i := 1 TO n DO
  369.      FOR j := 1 TO n DO
  370.        a[i,j] := i + j + 2;
  371.  END {procedure filla};
  372.  
  373.  
  374.  PROCEDURE FillB;
  375.  VAR i,j : INTEGER;
  376.  BEGIN
  377.    FOR i := 1 TO n DO
  378.      FOR j := 1 TO n DO
  379.        b[i,j] := (i + j + 2) DIV (j + 1);
  380.  END {procedure fillb};PROCEDURE FillC;VAR i,j : INTEGER;
  381.  BEGIN
  382.    FOR i := 1 TO n DO
  383.      FOR j := 1 TO n DO
  384.        c[i,j] := 0.0;
  385.  END {procedure fillc};
  386.  
  387.  BEGIN
  388.    sum := 0.0;
  389.    Write('Press <CR> to start');
  390.    Read(ch);
  391.    Writeln;
  392.    FillA; Writeln('A filled');
  393.    FillB; Writeln('B filled');
  394.    FillC; Writeln('C filled');
  395.    FOR i := 1 TO n DO
  396.      FOR jk := 1 TO n DO
  397.        FOR k := 1 TO n DO
  398.          c[i,j] := c[i,j] + a[i,k] * B[k,j];
  399.    Writeln('Multiplied');
  400.    FOR i := 1 TO n DO
  401.      FOR j := 1 TO n DO
  402.        sum := sum + c[i,j];
  403.    Writeln('sum = ',sum);
  404.    Writeln('End of program');
  405.  END {CLMatrix}.
  406.  
  407.  
  408.  
  409.  [Reprinted from the March, 1986 issue of CURRENT NOTES: The Newsletter for
  410.  Atari Owners.  CURRENT NOTES is published by the Washington Area Atari
  411.  Computer Enthusiasts, 122 N. Johnson Rd., Sterling, VA 22170 ($15/yr).  This
  412.  article may be reprinted by any Atari user group newsletter provided CURRENT
  413.  NOTES and the author are cited.]
  414.  
  415.  
  416.  
  417. Press <CR> to continue: